Located at the top of .qmd files.
Surrounded by triple dashes ---.
Controls:
Title, author, date
Output format
Table of contents
Fonts, themes
Citations, bibliography
Code execution
| Option | Purpose |
|---|---|
title: |
Title of document |
subtitle: |
Subtitle |
author: |
Author(s) |
date: |
Date shown in output |
Example:
format:
docx:
reference-doc: "custom-style.docx"
toc: true
toc-depth: 2
number-sections: true
keep-md: true| Option | Purpose |
|---|---|
reference-doc: |
Custom style Word file |
toc: |
Table of contents |
toc-depth: |
TOC levels |
number-sections: |
Numbered headings |
| Option | Purpose |
|---|---|
echo: |
Show code? |
eval: |
Evaluate code? |
warning: |
Show warnings? |
error: |
Show errors? |
message: |
Show messages? |
theme: sets visual style (for HTML/Slides)mainfont: customizes fontfontsize: sets sizegeometry: sets marginstoc: add table of contentstoc-depth: depth of headingstoc-title: title nametoc-location: place TOC left, right, inlinebibliography: BibTeX file pathcsl: Citation Style Language fileciteproc: Use citation processor---
title: "Research Report"
subtitle: "Financial Analysis 2025"
author: "A Student"
date: today
format:
docx:
reference-doc: "template.docx"
toc: true
toc-depth: 2
number-sections: true
execute:
echo: true
warning: false
theme: cosmo
mainfont: "Georgia"
fontsize: 11pt
geometry: margin=1in
bibliography: refs.bib
csl: apa.csl
editor: visual
---✅ YAML is indentation-sensitive.
✅ Use spaces (not tabs).
✅ Check filenames carefully.
✅ Maintain consistent structure.
| Block | Purpose |
|---|---|
title, author, date |
Metadata |
format: |
Output type |
execute: |
Code settings |
theme, font, size |
Appearance |
toc, number-sections |
Structure |
bibliography, csl |
Citations |
✅ Create a YAML that:
Title: “Student Report”
Author: “Your Name”
Date: today
Format: docx with TOC
Font: Times New Roman, fontsize 12pt
Theme: simple
Happy Document Writing!